// super class for all movable objects in game 
public class Movable {

	private int health = 1; // one hit kill by default; change in subclasses
	// object's direction; most applicable to Ship subclass
	private double direction = 0.5 * Math.PI;
	private double velX, velY = 0;
	// current cartesian-grid coordinates
	private double xCor, yCor;


	public Movable(int x, int y) {
		xCor = x;
		yCor = y;
	}

	public void turnLeft() { direction+=10; }

	public void turnRight() { direction-=10; }

	// 180-degree turn (down arrow for player)
	public void turnAround() { direction += 180; }

	public void accelerate(double velocity) {
		velx += velocity * Math.cos(direction);
		vely += velocity * Math.sin(direction);
	}

	public void takeDamage(int damageSum) {
    health = health - damageSum;
		if (health <= 0) {
			destruct(this);
		}
	}
}
